window.onload = function () {
    $(".headright").click(function () {
        //alert(1);
        $(".headright").css({"display": "none"});
        $(".headright2").css({"display": "block"});
        $(".right").css({"transition": "1s", "transform": "translate(-1.86rem,0)"});
        $(".left").css({"transition": "1s", "transform": "translate(-1.86rem,0)"});
        $("footer").css({"transition": "1s", "transform": "translate(-1.86rem,0)"});
    });
    $(".headright2").click(function () {
        //alert(2);
        $(".headright").css({"display": "block"});
        $(".headright2").css({"display": "none"});
        $(".right").css({"transition": "1s", "transform": "translate(0,0)"});
        $(".left").css({"transition": "1s", "transform": "translate(0,0)"});
        $("footer").css({"transition": "1s", "transform": "translate(0,0)"});
    });
    $(".righta").click(function () {
        //alert(2);
        $(".headright").css({"display": "block"});
        $(".headright2").css({"display": "none"});
        $(".right").css({"transition": "1s", "transform": "translate(0,0)"});
        $(".left").css({"transition": "1s", "transform": "translate(0,0)"});
        $("footer").css({"transition": "1s", "transform": "translate(0,0)"});
    });

    $(".mapjs").click(function () {
        $(".map").css({"transition": "1s", "transform": "translate(0,-13.33rem)"});
    });
    $(".mapreturn").click(function () {
        $(".map").css({"transition": "1s", "transform": "translate(0,0)"});
    });


    $('.bannerright').click(function () {
        $("#banner ul").animate({marginLeft: "-7.23rem"}, 200, function () {
            $("#banner ul>li").eq(0).appendTo($("#banner ul"));
            $("#banner ul").css('marginLeft', '0px');
        });
    });
    $('.bannerleft').click(function () {
        $("#banner ul").css('marginLeft', '-7.23rem');
        $("#banner ul>li").eq(3).prependTo($("#banner ul"));
        $("#banner ul").animate({marginLeft: "0px"}, 200);

    });
    $('.bannerright2').click(function () {
        $("#banner ul").animate({marginLeft: "-7.23rem"}, 200, function () {
            $("#banner ul>li").eq(0).appendTo($("#banner ul"));
            $("#banner ul").css('marginLeft', '0px');
        });
    });
    $('.bannerleft2').click(function () {
        $("#banner ul").css('marginLeft', '-7.23rem');
        $("#banner ul>li").eq(3).prependTo($("#banner ul"));
        $("#banner ul").animate({marginLeft: "0px"}, 200);

    });
};

var myapp = angular.module('myapp', ['ui.router']);
myapp.controller('islogin', ['$http', '$scope', function ($http, $scope) {
    $scope.nologined = false;
    $scope.logined = false;
    $scope.Exit=function () {
        $http.get('/user/loginoff')
            .then(function () {
                location.href='index.html';
            });
    };
    $http.get('/user/isLogin')
        .then(function (res) {
            if (res.data.status) {
                var username = res.data.data[0].username;
                $http.post('/user/getuser',{username:username}).then(function (res) {
                    $scope.name=res.data.data[0].name;
                });
                $scope.logined = true;
            } else {
                $scope.nologined = true;
                $scope.logined = false;
            }
        })
}]);
myapp.config(['$stateProvider', '$locationProvider', '$urlRouterProvider', function ($stateProvider, $locationProvider, $urlRouterProvider) {
    $locationProvider.hashPrefix('');
    $stateProvider.state('index', {
        url: '/index',
        views: {
            'inDex': {
                templateUrl: './tpls/product-index.tpl.html',
                controller: 'index.ctrl'
            }
        }
    }).state('list1', {
        url: '/list1',
        views: {
            'listView1': {
                templateUrl: './tpls/product-list1.tpl.html',
                controller: 'list1.ctrl'
            }
        }
    }).state('list2', {
        url: '/list2',
        views: {
            'listView2': {
                templateUrl: './tpls/product-list2.tpl.html',
                controller: 'list2.ctrl'
            }
        }
    }).state('list3', {
        url: '/list3',
        views: {
            'listView3': {
                templateUrl: './tpls/product-list3.tpl.html',
                controller: 'list3.ctrl'
            }
        }
    }).state('list4', {
        url: '/list4',
        views: {
            'listView4': {
                templateUrl: './tpls/product-list4.tpl.html',
                controller: 'list4.ctrl'
            }
        }
    }).state('ly', {
        url: '/ly',
        views: {
            'messAge': {
                templateUrl: './tpls/product-message.tpl.html',
                controller: 'ly.ctrl'
            }
        }
    }).state('hz', {
        url: '/hz',
        views: {
            'cooperaTion': {
                templateUrl: './tpls/product-cooperation.tpl.html',
                controller: 'hz.ctrl'
            }
        }
    }).state('jj', {
        url: '/jj',
        views: {
            'messAge': {
                templateUrl: './tpls/product-introDuction.tpl.html',
                controller: 'jj.ctrl'
            }
        }
    }).state('pz', {
        url: '/pz',
        views: {
            'qualityOf': {
                templateUrl: './tpls/product-qualityOf.tpl.html',
                controller: 'pz.ctrl'
            }
        }
    });
    $urlRouterProvider.otherwise('index');
}]);
myapp.controller('ly.ctrl', [function () {

}]);
myapp.controller('hz.ctrl', [function () {

}]);
myapp.controller('jj.ctrl', [function () {

}]);
myapp.controller('pz.ctrl', [function () {

}]);
myapp.controller('myctrl', ['$scope', function ($scope) {
    $scope.slideList = [
        {_id: 0, src: "lunbo/hzpp1.jpg", title: '曼哈顿', iid: 0},
        {_id: 1, src: "lunbo/hzpp2.jpg", title: '柒牌', iid: 1},
        {_id: 2, src: "lunbo/hzpp3.jpg", title: '卡巴雷赛', iid: 2},
        {_id: 3, src: "lunbo/hzpp4.jpg", title: '劲霸男装', iid: 3},
        {_id: 4, src: "lunbo/hzpp5.jpg", title: '劲霸男装', iid: 4},
        {_id: 5, src: "lunbo/hzpp6.jpg", title: '劲霸男装', iid: 5},
        {_id: 6, src: "lunbo/hzpp7.jpg", title: '劲霸男装', iid: 6},
        {_id: 7, src: "lunbo/hzpp8.jpg", title: '劲霸男装', iid: 7},
        {_id: 8, src: "lunbo/hzpp9.jpg", title: '劲霸男装', iid: 8},
        {_id: 9, src: "lunbo/hzpp10.jpg", title: '劲霸男装', iid: 9}


    ];
    $scope.slideListtwo = [
        {_id: 0, src: "lunbo/hdjj1.jpg", title: '曼哈顿', iid: 0},
        {_id: 1, src: "lunbo/hdjj2.jpg", title: '柒牌', iid: 1},
        {_id: 2, src: "lunbo/hdjj3.jpg", title: '卡巴雷赛', iid: 2},
        {_id: 3, src: "lunbo/hdjj4.jpg", title: '劲霸男装', iid: 3},
        {_id: 4, src: "lunbo/hdjj5.jpg", title: '劲霸男装', iid: 4},
        {_id: 5, src: "lunbo/hdjj6.jpg", title: '劲霸男装', iid: 5},
        {_id: 6, src: "lunbo/hdjj7.jpg", title: '劲霸男装', iid: 6},
        {_id: 7, src: "lunbo/hdjj8.jpg", title: '劲霸男装', iid: 7},
        {_id: 8, src: "lunbo/hdjj9.jpg", title: '劲霸男装', iid: 8},
        {_id: 9, src: "lunbo/hdjj10.jpg", title: '劲霸男装', iid: 9}


    ];
    $scope.name = 2;
    $scope.id = 0;
}]);


